module sub_vector(/*AUTOARG*/
   // Outputs
   o_diff, o_borrows,
   // Inputs
   i_a, i_b, i_mode
   );

   parameter width = 64;		// total width
   parameter granu = 8;			// granularity(8/16/32/64)
   localparam fields_num = width / granu;
   localparam mode_num = log2(fields_num) + 1; // the num of mode

   output logic [width-1:0] o_diff;
   output logic [fields_num-1:0] o_borrows;
   
   input logic [fields_num-1:0][granu-1:0] i_a, i_b;	// the addend
   input logic [mode_num-1:0] 			   i_mode;
   
   
   logic [width-1:0] 					   diff_inv;
   logic [fields_num-1:0] 				   borrows;
   
   add_vector #(.width(width),
				.granu(granu)) U_add_vector(
											// Outputs
											.o_sum				(diff_inv),
											.o_carrys			(borrows),
											// Inputs
											.i_a				(~i_a),
											.i_b				(i_b),
											.i_mode				(i_mode) );
   

   assign o_diff = ~diff_inv;		// diff = i_a - i_b
   assign o_borrows = borrows;

endmodule // sub_mix
